/**
 * Huisou.com Inc.
 * Copyright (c) 2011-2012 All Rights Reserved.
 */

package com.lyqg.action;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.core.json.JsonMapper;
import com.core.utils.WebUtil;
import com.lyqg.biz.IAdContentService;
import com.lyqg.biz.IContentService;
import com.lyqg.domain.AdContent;

/**
 * @description
 * 
 * @author chenzehe
 * @email hljuczh@163.com
 * @create 2012-7-20 下午11:15:36
 */
@Controller
public class AdAction extends BaseAction {
	@Resource
	IContentService contentService;
	@Resource
	IAdContentService adContentService;

	@RequestMapping(value = "/ad/getad.html")
	@ResponseBody
	public String getAdContent(HttpServletRequest request, ModelMap model) {
		int position = WebUtil.getInt(request, "position");
		List<AdContent> adContents = adContentService.queryByPosition(position);
		JsonMapper jm = JsonMapper.buildNonNullMapper();
		return jm.toJson(adContents);
	}
}
